<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>有间工作室-点击付款</title>
    <style>
        .btn{
            background-color: aquamarine;
            border:none;
            height:50px;
            width:120px;
            margin-top: 50px;
            color: black;
            font-size: 24px;
            border-radius: 5px;
        }
        .btn:hover{
            font-size: 26px;
        }
        a{
            text-decoration: none;
            color: black;
        }
        a:hover{
            color: red;
        }
    </style>
    <script type="text/javascript" src="/static/index/js/jquery-1.12.4.min.js"></script>
    <script>
        // 实现点击事件验证
        $(document).ready(function(){
            $("#bt1").bind("click",function(){
                var point = $("#point").val();
                var addr =  $("#bt1").attr('href');
                var user = $("#user").val();
                {#alert("bt1");#}

                var params = {
                    "user": user,
                    "point": point,
                    "addr": addr
                };
                    $.ajax({
                    url: "/user/pay_ment",
                    type: "POST",
                    data: JSON.stringify(params),
                    contentType: "application/json",
                    success:function (resp) {
                        if(resp.errno == "0"){
                            //成功提交订单
                            alert(resp.errmsg);
                            {#window.location.href="{{  }}"#}
                        } else {
                    // `提交订单失败
                    alert(resp.errmsg);
                }
                    }
                });
            });

            $("#bt2").on("click",function(){
                var user = $("#user").val();
                var point = $("#point").val();
                var addr =  $("#bt2").attr('href');
                {#alert('bt2');#}
                var params = {
                    "user": user,
                    "point": point,
                    "addr": addr
                };

                $.ajax({
                    url: "/user/pay_ment",
                    type: "POST",
                    data: JSON.stringify(params),
                    contentType: "application/json",
                    success:function (resp) {
                        if(resp.errno == "1002"){
                            //取消订单跳转到订单页面
                            window.location.href="{{ url_for('user_blue.pay_info') }}";
                              {#alert(resp.errmsg);#}
                        }  else {
                    // `设置`个人信息失败
                    alert(resp.errmsg);
                }
                    }
                });
            });

        });

    </script>
</head>
<body>
    <div align="center" style="border: 1px solid black; height: 300px;
     margin: 0 auto; background-color: black">
        <h1 style="color: #f7a280">有间工作室 提醒您：</h1>
        <h2 style="color: white">确认订单后点击下方 按钮 进行付款</h2>
        <button type="button" class="btn" ><a href="{{ pay }}" id="bt1">付款</a></button>
        <button type="button" class="btn"><a href="#"  id="bt2">取消付款</a></button>
        <input type="hidden" value="{{ point }}" id="point" name="point">
        <input type="hidden" value="{{ user }}" id="user" name="user">
    </div>
</body>
</html>